<%@ page import="top.yxqz.filter.pojo.BookType" %>
<%@ page import="top.yxqz.filter.pojo.Book" %>
<%@ page import="java.util.ArrayList" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<%--栅格--%>
<body>
<%
    BookType bookType1 = new BookType("计算机", "好好学习的");
    BookType bookType2 = new BookType("童话", "好好学习的");
    BookType bookType3 = new BookType("玄幻", "好好学习的");
    Book book1 = new Book("ISB-1001", "三天速成JavaWeb", 9.9, "关羽", bookType1);
    Book book2 = new Book("ISB-1002", "四天速成JavaWeb", 19.9, "马超", bookType1);
    Book book3 = new Book("ISB-1003", "五天速成JavaWeb", 29.9, "赵云", bookType1);
    Book book4 = new Book("ISB-1004", "六天速成JavaWeb", 39.9, "张飞", bookType2);
    Book book5 = new Book("ISB-1005", "七天速成JavaWeb", 49.9, "黄忠", bookType3);

    ArrayList<Book> books = new ArrayList<Book>();
    books.add(book1);
    books.add(book2);
    books.add(book3);
    books.add(book4);
    books.add(book5);

    pageContext.setAttribute("books", books);

%>


<div class="container">
    <div class="row">

        <div class="col">
            <%--            数据表格--%>
            <table class="table table-danger text-center">
                <thead>
                <tr>
                    <th scope="col">#</th>
                    <th scope="col">图书编号</th>
                    <th scope="col">图书名称</th>
                    <th scope="col">图书价格</th>
                    <th scope="col">作者</th>
                    <th scope="col">图书类型</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${books}" var="book" varStatus="vs">
                    <tr>
                        <th scope="row">${vs.count}</th>
                        <td>${book.bookID}</td>
                        <td>${book.bookName}</td>
                        <td>${book.bookPay}</td>
                        <td>${book.author}</td>
                        <td>${book.bookType.typeName}</td>
                    </tr>
                </c:forEach>

                <%--                <tr>--%>
                <%--                    <th scope="row">1</th>--%>
                <%--                    <td>Mark</td>--%>
                <%--                    <td>Otto</td>--%>
                <%--                    <td>@mdo</td>--%>
                <%--                    <td>@mdo</td>--%>
                <%--                    <td>@mdo</td>--%>
                <%--                </tr>--%>

                </tbody>
            </table>
            <hr>
            <%--            评论框 表单提交--%>
            <form action="${pageContext.request.contextPath}/comment" method="get">
                <textarea class="form-control" name="comment" id="exampleFormControlTextarea1" rows="3"
                          placeholder="请好好说话"></textarea>
                <div class="row">
                    <div class="col">
                    </div>
                    <div class="col">
                    </div>
                    <div class="col">
                        <button type="submit" class="btn btn-primary" style="float: right;margin-top: 5px">发送</button>
                    </div>
                </div>
            </form>

            <%--            评论的内容--%>
            <div class="alert alert-primary" role="alert" >
                ${comment}
            </div>
        </div>

    </div>
</div>

<script src="js/bootstrap.bundle.min.js"/>
</body>
</html>
